package org.bim.view.drag.design.entity;

import cn.hutool.core.lang.Snowflake;
import cn.hutool.core.util.IdUtil;
import tk.mybatis.mapper.genid.GenId;

/**
 * 使用雪花算法生成int类型的id，再转字符串。兼容下avue-data的数据
 *
 * @author bim-view
 * @date 2021/12/17 2:11 下午
 */
public class NumGenId implements GenId<String> {
    private long workerId=30 ;//为终端ID
    private long datacenterId = 28;//数据中心ID
    private Snowflake snowflake = IdUtil.getSnowflake(workerId,datacenterId);
    @Override
    public String genId(String table, String column) {
        return String.valueOf(Long.valueOf(snowflake.nextId()).intValue());
    }
}
